/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PropertyPanel.java
 *
 * Created on Aug 15, 2011, 7:02:06 AM
 */
package b_and_b_properties;

import b_and_b_properties.data.DAO;
import b_and_b_properties.data.Property;
import b_and_b_properties.data.Room;
import b_and_b_properties.data.Unit;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Omea
 */
public class PropertyEntryPanel extends JPanel {

    boolean isOldProperty = false;

    /** Creates new form PropertyPanel */
    public PropertyEntryPanel(DAO dao) {
        initComponents();
        this.dao = dao;
        this.property = new Property();
        fcPic1.addChoosableFileFilter(new ImageFilter());
        fcPic2.addChoosableFileFilter(new ImageFilter());
        fcPic3.addChoosableFileFilter(new ImageFilter());
        fcPic4.addChoosableFileFilter(new ImageFilter());
        fcPic5.addChoosableFileFilter(new ImageFilter());
        fcPic6.addChoosableFileFilter(new ImageFilter());
    }

    /** Creates new form PropertyPanel */
    public PropertyEntryPanel(DAO dao, Property property) {
        initComponents();
        this.dao = dao;
        this.property = property;
    }

    public void setPDP(PropertyDetailPanel pdp) {
        this.pdp = pdp;
    }

    private void loadPropertyData() {
        agentRemarksField.setText(property.getAgentremarks());
        cityField.setText(property.getCity());
        countyField.setText(property.getCounty());
        crossStreetField.setText(property.getCrossstreet());
        directionsField.setText(property.getDirections());
        financingRemarksField.setText(property.getFinancingremarks());
        foundationField.setText(property.getFoundation().toString());
        levelsField.setText(property.getLevels().toString());
        marketingRemarksField.setText(property.getMarketingremarks());
        ownerField.setText(property.getOwner());
        petDepositAmountField.setText(property.getPetdepositamount().toString());
        petDepositAmountField.setText(property.getPetdeposit().toString());
        petRestrictionsField.setText(property.getPetrestrictions().toString());
        petsAllowedField.setText(property.getPetsallowed().toString());
        roofField.setText(property.getRoof().toString());
        schoolDistrictField.setText(property.getSchooldistrict());
        specialFinancingField.setText(property.getSpecialfinancing().toString());
        stateField.setText(property.getPstate());
        streetDirField.setText(property.getStreetdir().toString());
        streetNameField.setText(property.getStreetname());
        streetNumberField.setText(property.getStreetname());
        streetSuffixField.setText(property.getStreetsuffix());
        subdivisionField.setText(property.getSubdivision());
        taxIDField.setText(property.getTaxid());
        townshipField.setText(property.getTownship());
        typeField.setText(property.getPtype().toString());
        zipCodeField.setText(property.getZoning());
        jtfNumUnits.setText(Integer.toString(property.getUnitArrayLength()));
        jbPicture1.doClick();
        jbPicture2.doClick();
        jbPicture3.doClick();
        jbPicture4.doClick();
        jbPicture5.doClick();
        jbPicture6.doClick();
        /* -- need to change the fcPic1.getSelectedFile().toString()
         * to the get method in the property object when it
         * is added
         *
        Image file = new ImageIcon(fcPic1.getSelectedFile().toString()).getImage();
        picture1Panel.add(new ImageViewer(file));
        Image file2 = new ImageIcon(fcPic2.getSelectedFile().toString()).getImage();
        picture2Panel.add(new ImageViewer(file2));
        Image file3 = new ImageIcon(fcPic3.getSelectedFile().toString()).getImage();
        picture3Panel.add(new ImageViewer(file3));
        Image file4 = new ImageIcon(fcPic4.getSelectedFile().toString()).getImage();
        picture4Panel.add(new ImageViewer(file4));
        Image file5 = new ImageIcon(fcPic5.getSelectedFile().toString()).getImage();
        picture5Panel.add(new ImageViewer(file5));
        Image file5 = new ImageIcon(fcPic6.getSelectedFile().toString()).getImage();
        picture6Panel.add(new ImageViewer(file6));*/

        // Need to do this        showingInstructionsField.setText(property.getShow)
    }

    private String validateNonNull(String var) {
        String ret;
        ret = (var == null) ? "0" : var;
        ret = (ret == "") ? "0" : ret;
        return ret;
    }

    private double getPetdepositamount() {
        try {
            return Double.parseDouble(validateNonNull(petDepositAmountField.getText()));
        } catch (Exception e) {
            return 0.00;
        }
    }

    private int getStreetNumber() {
        try {
            return Integer.parseInt(validateNonNull(streetNumberField.getText()));
        } catch (Exception e) {
            return 0;
        }
    }

    private int getZipCode() {
        try {
            return Integer.parseInt(validateNonNull(zipCodeField.getText()));
        } catch (Exception e) {
            return 0;
        }
    }

    protected void savePropertyData() {
        //    throw new UnsupportedOperationException("Not yet implemented");
        property.setAgentremarks(agentRemarksField.getText());
        property.setCity(cityField.getText());
        property.setCounty(countyField.getText());
        property.setCrossstreet(crossStreetField.getText());
        property.setDirections(directionsField.getText());
        property.setFinancingremarks(financingRemarksField.getText());
        property.setFoundation(foundationField.getText());
        property.setLevels(levelsField.getText());
        property.setMarketingremarks(marketingRemarksField.getText());
        property.setOwner(ownerField.getText());
        property.setPetdepositamount(getPetdepositamount());
        property.setPetrestrictions(petRestrictionsField.getText());
        property.setPetsallowed(petsAllowedField.getText());
        property.setSchooldistrict(schoolDistrictField.getText());
        property.setShowinginstructions(showingInstructionsField.getText());
        property.setSpecialfinancing(specialFinancingField.getText());
        property.setPstate(stateField.getText());
        property.setStreetdir(streetDirField.getText());
        property.setStreetname(streetNameField.getText());
        property.setStreetnumber(getStreetNumber());
        property.setStreetsuffix(streetSuffixField.getText());
        property.setSubdivision(subdivisionField.getText());
        property.setTaxid(taxIDField.getText());
        property.setTownship(townshipField.getText());
        property.setPtype(typeField.getText());
        property.setZipcode(getZipCode());
        try {
            property.setPicture1(fcPic1.getSelectedFile().toString().replace('\\', '/'));
        } catch (Exception e) {
        }
        try {
            property.setPicture2(fcPic2.getSelectedFile().toString().replace('\\', '/'));
        } catch (Exception e) {
        }
        try {
            property.setPicture3(fcPic3.getSelectedFile().toString().replace('\\', '/'));
        } catch (Exception e) {
        }
        try {
            property.setPicture4(fcPic4.getSelectedFile().toString().replace('\\', '/'));
        } catch (Exception e) {
        }
        try {
            property.setPicture5(fcPic5.getSelectedFile().toString().replace('\\', '/'));
        } catch (Exception e) {
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        streetNumberLabel = new javax.swing.JLabel();
        streetDirLabel = new javax.swing.JLabel();
        streetNameLabel = new javax.swing.JLabel();
        streetSuffixLabel = new javax.swing.JLabel();
        cityLabel = new javax.swing.JLabel();
        stateLabel = new javax.swing.JLabel();
        zipCodeLabel = new javax.swing.JLabel();
        crossStreetLabel = new javax.swing.JLabel();
        countyLabel = new javax.swing.JLabel();
        taxIDLabel = new javax.swing.JLabel();
        typeLabel = new javax.swing.JLabel();
        showingInstructionsLabel = new javax.swing.JLabel();
        petsAllowedLabel = new javax.swing.JLabel();
        petRestrictionsLabel = new javax.swing.JLabel();
        petDepositAmountLabel = new javax.swing.JLabel();
        schoolDistrictLabel = new javax.swing.JLabel();
        ownerLabel = new javax.swing.JLabel();
        townshipLabel = new javax.swing.JLabel();
        subdivisionLabel = new javax.swing.JLabel();
        marketingRemarksLabel = new javax.swing.JLabel();
        agentRemarksLabel = new javax.swing.JLabel();
        directionsLabel = new javax.swing.JLabel();
        specialFinancingLabel = new javax.swing.JLabel();
        financingRemarksLabel = new javax.swing.JLabel();
        levelsLabel = new javax.swing.JLabel();
        foundationLabel = new javax.swing.JLabel();
        roofLabel = new javax.swing.JLabel();
        streetNumberField = new javax.swing.JTextField();
        streetDirField = new javax.swing.JTextField();
        streetNameField = new javax.swing.JTextField();
        streetSuffixField = new javax.swing.JTextField();
        cityField = new javax.swing.JTextField();
        stateField = new javax.swing.JTextField();
        zipCodeField = new javax.swing.JTextField();
        crossStreetField = new javax.swing.JTextField();
        countyField = new javax.swing.JTextField();
        taxIDField = new javax.swing.JTextField();
        typeField = new javax.swing.JTextField();
        showingInstructionsField = new javax.swing.JTextField();
        petsAllowedField = new javax.swing.JTextField();
        petRestrictionsField = new javax.swing.JTextField();
        petDepositAmountField = new javax.swing.JTextField();
        schoolDistrictField = new javax.swing.JTextField();
        ownerField = new javax.swing.JTextField();
        townshipField = new javax.swing.JTextField();
        subdivisionField = new javax.swing.JTextField();
        marketingRemarksField = new javax.swing.JTextField();
        agentRemarksField = new javax.swing.JTextField();
        directionsField = new javax.swing.JTextField();
        specialFinancingField = new javax.swing.JTextField();
        financingRemarksField = new javax.swing.JTextField();
        levelsField = new javax.swing.JTextField();
        foundationField = new javax.swing.JTextField();
        roofField = new javax.swing.JTextField();
        saveButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        newButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jbPicture1 = new javax.swing.JButton();
        picture1Panel = new javax.swing.JPanel();
        jbPicture2 = new javax.swing.JButton();
        picture2Panel = new javax.swing.JPanel();
        jbPicture3 = new javax.swing.JButton();
        picture3Panel = new javax.swing.JPanel();
        jbPicture4 = new javax.swing.JButton();
        picture4Panel = new javax.swing.JPanel();
        jbPicture5 = new javax.swing.JButton();
        picture5Panel = new javax.swing.JPanel();
        jbPicture6 = new javax.swing.JButton();
        picture6Panel = new javax.swing.JPanel();
        singleFamilyRadio = new javax.swing.JRadioButton();
        multiFamilyRadio = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jtfNumUnits = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jcbUnitNumbers = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();

        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(1095, 758));

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(b_and_b_properties.B_and_B_PropertiesApp.class).getContext().getResourceMap(PropertyEntryPanel.class);
        streetNumberLabel.setText(resourceMap.getString("streetNumberLabel.text")); // NOI18N
        streetNumberLabel.setName("streetNumberLabel"); // NOI18N

        streetDirLabel.setText(resourceMap.getString("streetDirLabel.text")); // NOI18N
        streetDirLabel.setName("streetDirLabel"); // NOI18N

        streetNameLabel.setText(resourceMap.getString("streetNameLabel.text")); // NOI18N
        streetNameLabel.setName("streetNameLabel"); // NOI18N

        streetSuffixLabel.setText(resourceMap.getString("streetSuffixLabel.text")); // NOI18N
        streetSuffixLabel.setName("streetSuffixLabel"); // NOI18N

        cityLabel.setText(resourceMap.getString("cityLabel.text")); // NOI18N
        cityLabel.setName("cityLabel"); // NOI18N

        stateLabel.setText(resourceMap.getString("stateLabel.text")); // NOI18N
        stateLabel.setName("stateLabel"); // NOI18N

        zipCodeLabel.setText(resourceMap.getString("zipCodeLabel.text")); // NOI18N
        zipCodeLabel.setName("zipCodeLabel"); // NOI18N

        crossStreetLabel.setText(resourceMap.getString("crossStreetLabel.text")); // NOI18N
        crossStreetLabel.setName("crossStreetLabel"); // NOI18N

        countyLabel.setText(resourceMap.getString("countyLabel.text")); // NOI18N
        countyLabel.setName("countyLabel"); // NOI18N

        taxIDLabel.setText(resourceMap.getString("taxIDLabel.text")); // NOI18N
        taxIDLabel.setName("taxIDLabel"); // NOI18N

        typeLabel.setText(resourceMap.getString("typeLabel.text")); // NOI18N
        typeLabel.setName("typeLabel"); // NOI18N

        showingInstructionsLabel.setText(resourceMap.getString("showingInstructionsLabel.text")); // NOI18N
        showingInstructionsLabel.setName("showingInstructionsLabel"); // NOI18N

        petsAllowedLabel.setText(resourceMap.getString("petsAllowedLabel.text")); // NOI18N
        petsAllowedLabel.setName("petsAllowedLabel"); // NOI18N

        petRestrictionsLabel.setText(resourceMap.getString("petRestrictionsLabel.text")); // NOI18N
        petRestrictionsLabel.setName("petRestrictionsLabel"); // NOI18N

        petDepositAmountLabel.setText(resourceMap.getString("petDepositAmountLabel.text")); // NOI18N
        petDepositAmountLabel.setName("petDepositAmountLabel"); // NOI18N

        schoolDistrictLabel.setText(resourceMap.getString("schoolDistrictLabel.text")); // NOI18N
        schoolDistrictLabel.setName("schoolDistrictLabel"); // NOI18N

        ownerLabel.setText(resourceMap.getString("ownerLabel.text")); // NOI18N
        ownerLabel.setName("ownerLabel"); // NOI18N

        townshipLabel.setText(resourceMap.getString("townshipLabel.text")); // NOI18N
        townshipLabel.setName("townshipLabel"); // NOI18N

        subdivisionLabel.setText(resourceMap.getString("subdivisionLabel.text")); // NOI18N
        subdivisionLabel.setName("subdivisionLabel"); // NOI18N

        marketingRemarksLabel.setText(resourceMap.getString("marketingRemarksLabel.text")); // NOI18N
        marketingRemarksLabel.setName("marketingRemarksLabel"); // NOI18N

        agentRemarksLabel.setText(resourceMap.getString("agentRemarksLabel.text")); // NOI18N
        agentRemarksLabel.setName("agentRemarksLabel"); // NOI18N

        directionsLabel.setText(resourceMap.getString("directionsLabel.text")); // NOI18N
        directionsLabel.setName("directionsLabel"); // NOI18N

        specialFinancingLabel.setText(resourceMap.getString("specialFinancingLabel.text")); // NOI18N
        specialFinancingLabel.setName("specialFinancingLabel"); // NOI18N

        financingRemarksLabel.setText(resourceMap.getString("financingRemarksLabel.text")); // NOI18N
        financingRemarksLabel.setName("financingRemarksLabel"); // NOI18N

        levelsLabel.setText(resourceMap.getString("levelsLabel.text")); // NOI18N
        levelsLabel.setName("levelsLabel"); // NOI18N

        foundationLabel.setText(resourceMap.getString("foundationLabel.text")); // NOI18N
        foundationLabel.setName("foundationLabel"); // NOI18N

        roofLabel.setText(resourceMap.getString("roofLabel.text")); // NOI18N
        roofLabel.setName("roofLabel"); // NOI18N

        streetNumberField.setName("streetNumberField"); // NOI18N

        streetDirField.setName("streetDirField"); // NOI18N

        streetNameField.setName("streetNameField"); // NOI18N

        streetSuffixField.setName("streetSuffixField"); // NOI18N

        cityField.setName("cityField"); // NOI18N

        stateField.setColumns(2);
        stateField.setText(resourceMap.getString("stateField.text")); // NOI18N
        stateField.setName("stateField"); // NOI18N

        zipCodeField.setName("zipCodeField"); // NOI18N

        crossStreetField.setName("crossStreetField"); // NOI18N

        countyField.setName("countyField"); // NOI18N

        taxIDField.setName("taxIDField"); // NOI18N

        typeField.setName("typeField"); // NOI18N

        showingInstructionsField.setText(resourceMap.getString("showingInstructionsField.text")); // NOI18N
        showingInstructionsField.setName("showingInstructionsField"); // NOI18N

        petsAllowedField.setName("petsAllowedField"); // NOI18N

        petRestrictionsField.setName("petRestrictionsField"); // NOI18N

        petDepositAmountField.setName("petDepositAmountField"); // NOI18N

        schoolDistrictField.setName("schoolDistrictField"); // NOI18N

        ownerField.setName("ownerField"); // NOI18N

        townshipField.setName("townshipField"); // NOI18N

        subdivisionField.setName("subdivisionField"); // NOI18N

        marketingRemarksField.setName("marketingRemarksField"); // NOI18N

        agentRemarksField.setName("agentRemarksField"); // NOI18N

        directionsField.setName("directionsField"); // NOI18N

        specialFinancingField.setName("specialFinancingField"); // NOI18N

        financingRemarksField.setName("financingRemarksField"); // NOI18N

        levelsField.setName("levelsField"); // NOI18N

        foundationField.setName("foundationField"); // NOI18N

        roofField.setName("roofField"); // NOI18N

        saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N
        saveButton.setName("saveButton"); // NOI18N
        saveButton.setPreferredSize(new java.awt.Dimension(75, 25));
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });

        deleteButton.setText(resourceMap.getString("deleteButton.text")); // NOI18N
        deleteButton.setName("deleteButton"); // NOI18N
        deleteButton.setPreferredSize(new java.awt.Dimension(75, 25));

        newButton.setText(resourceMap.getString("newButton.text")); // NOI18N
        newButton.setName("newButton"); // NOI18N
        newButton.setPreferredSize(new java.awt.Dimension(75, 25));

        jSeparator1.setName("jSeparator1"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(b_and_b_properties.B_and_B_PropertiesApp.class).getContext().getActionMap(PropertyEntryPanel.class, this);
        jbPicture1.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture1.setText(resourceMap.getString("jbPicture1.text")); // NOI18N
        jbPicture1.setName("jbPicture1"); // NOI18N
        jbPicture1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture1ActionPerformed(evt);
            }
        });

        picture1Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture1Panel.setName("picture1Panel"); // NOI18N

        javax.swing.GroupLayout picture1PanelLayout = new javax.swing.GroupLayout(picture1Panel);
        picture1Panel.setLayout(picture1PanelLayout);
        picture1PanelLayout.setHorizontalGroup(
            picture1PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture1PanelLayout.setVerticalGroup(
            picture1PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        jbPicture2.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture2.setText(resourceMap.getString("jbPicture2.text")); // NOI18N
        jbPicture2.setName("jbPicture2"); // NOI18N
        jbPicture2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture2ActionPerformed(evt);
            }
        });

        picture2Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture2Panel.setName("picture2Panel"); // NOI18N

        javax.swing.GroupLayout picture2PanelLayout = new javax.swing.GroupLayout(picture2Panel);
        picture2Panel.setLayout(picture2PanelLayout);
        picture2PanelLayout.setHorizontalGroup(
            picture2PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture2PanelLayout.setVerticalGroup(
            picture2PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        jbPicture3.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture3.setText(resourceMap.getString("jbPicture3.text")); // NOI18N
        jbPicture3.setName("jbPicture3"); // NOI18N
        jbPicture3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture3ActionPerformed(evt);
            }
        });

        picture3Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture3Panel.setName("picture3Panel"); // NOI18N

        javax.swing.GroupLayout picture3PanelLayout = new javax.swing.GroupLayout(picture3Panel);
        picture3Panel.setLayout(picture3PanelLayout);
        picture3PanelLayout.setHorizontalGroup(
            picture3PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture3PanelLayout.setVerticalGroup(
            picture3PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        jbPicture4.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture4.setText(resourceMap.getString("jbPicture4.text")); // NOI18N
        jbPicture4.setName("jbPicture4"); // NOI18N
        jbPicture4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture4ActionPerformed(evt);
            }
        });

        picture4Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture4Panel.setName("picture4Panel"); // NOI18N

        javax.swing.GroupLayout picture4PanelLayout = new javax.swing.GroupLayout(picture4Panel);
        picture4Panel.setLayout(picture4PanelLayout);
        picture4PanelLayout.setHorizontalGroup(
            picture4PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture4PanelLayout.setVerticalGroup(
            picture4PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        jbPicture5.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture5.setText(resourceMap.getString("jbPicture5.text")); // NOI18N
        jbPicture5.setName("jbPicture5"); // NOI18N
        jbPicture5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture5ActionPerformed(evt);
            }
        });

        picture5Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture5Panel.setName("picture5Panel"); // NOI18N

        javax.swing.GroupLayout picture5PanelLayout = new javax.swing.GroupLayout(picture5Panel);
        picture5Panel.setLayout(picture5PanelLayout);
        picture5PanelLayout.setHorizontalGroup(
            picture5PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture5PanelLayout.setVerticalGroup(
            picture5PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        jbPicture6.setAction(actionMap.get("picture1Button")); // NOI18N
        jbPicture6.setText(resourceMap.getString("jbPicture6.text")); // NOI18N
        jbPicture6.setName("jbPicture6"); // NOI18N
        jbPicture6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPicture6ActionPerformed(evt);
            }
        });

        picture6Panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        picture6Panel.setName("picture6Panel"); // NOI18N

        javax.swing.GroupLayout picture6PanelLayout = new javax.swing.GroupLayout(picture6Panel);
        picture6Panel.setLayout(picture6PanelLayout);
        picture6PanelLayout.setHorizontalGroup(
            picture6PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 337, Short.MAX_VALUE)
        );
        picture6PanelLayout.setVerticalGroup(
            picture6PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 164, Short.MAX_VALUE)
        );

        buttonGroup1.add(singleFamilyRadio);
        singleFamilyRadio.setText(resourceMap.getString("singleFamilyRadio.text")); // NOI18N
        singleFamilyRadio.setName("singleFamilyRadio"); // NOI18N
        singleFamilyRadio.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                singleFamilyRadioItemStateChanged(evt);
            }
        });

        buttonGroup1.add(multiFamilyRadio);
        multiFamilyRadio.setName("multiFamilyRadio"); // NOI18N
        multiFamilyRadio.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                multiFamilyRadioItemStateChanged(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jtfNumUnits.setColumns(2);
        jtfNumUnits.setName("jtfNumUnits"); // NOI18N
        jtfNumUnits.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jtfNumUnitsFocusLost(evt);
            }
        });

        jLabel2.setName("jLabel2"); // NOI18N

        jcbUnitNumbers.setMaximumRowCount(10);
        jcbUnitNumbers.setName("unitComboBox"); // NOI18N
        jcbUnitNumbers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbUnitNumbersActionPerformed(evt);
            }
        });

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 1023, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(singleFamilyRadio)
                            .addComponent(multiFamilyRadio))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jcbUnitNumbers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel4)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtfNumUnits, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 264, Short.MAX_VALUE)
                                .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(2176, 2176, 2176))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addContainerGap(2906, Short.MAX_VALUE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jbPicture4)
                            .addComponent(picture4Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jbPicture5)
                            .addComponent(picture5Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jbPicture6)
                            .addComponent(picture6Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(1890, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jbPicture1)
                                    .addComponent(picture1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jbPicture2)
                                    .addComponent(picture2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(8, 8, 8)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jbPicture3)
                                    .addComponent(picture3Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(townshipLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(townshipField, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(subdivisionLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(subdivisionField, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(roofLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(roofField, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(foundationLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(foundationField, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(levelsLabel))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(typeLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(petsAllowedLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(petsAllowedField, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(petRestrictionsLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(petRestrictionsField, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(petDepositAmountLabel)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(petDepositAmountField, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                                            .addComponent(levelsField, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                        .addGap(9, 9, 9)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(schoolDistrictLabel)
                                            .addComponent(marketingRemarksLabel)
                                            .addComponent(agentRemarksLabel)
                                            .addComponent(directionsLabel)
                                            .addComponent(specialFinancingLabel))
                                        .addGap(4, 4, 4)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(specialFinancingField, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(financingRemarksLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(financingRemarksField, javax.swing.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE))
                                            .addComponent(schoolDistrictField, javax.swing.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)
                                            .addComponent(marketingRemarksField, javax.swing.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)
                                            .addComponent(agentRemarksField, javax.swing.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)
                                            .addComponent(directionsField, javax.swing.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(cityLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(cityField, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(streetNumberLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(streetNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                                .addComponent(stateLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(stateField, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(streetDirLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(streetDirField, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(zipCodeLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(zipCodeField, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(countyLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(countyField, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addGap(296, 296, 296)
                                                        .addComponent(taxIDLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(taxIDField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(ownerLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(ownerField, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(streetNameLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(streetNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(streetSuffixLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(streetSuffixField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(crossStreetLabel)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(crossStreetField, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE))))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                        .addComponent(showingInstructionsLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(showingInstructionsField, javax.swing.GroupLayout.PREFERRED_SIZE, 834, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(93, 93, 93)))
                        .addGap(1892, 1892, 1892))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(singleFamilyRadio)
                            .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(multiFamilyRadio)
                                .addComponent(jLabel2))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addGap(1, 1, 1))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jtfNumUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcbUnitNumbers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))))
                .addGap(5, 5, 5)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(streetNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(streetNumberLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cityField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cityLabel)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(streetDirField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(streetNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(streetDirLabel)
                            .addComponent(streetNameLabel)
                            .addComponent(crossStreetLabel)
                            .addComponent(streetSuffixLabel)
                            .addComponent(streetSuffixField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(crossStreetField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(zipCodeLabel)
                            .addComponent(zipCodeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(countyLabel)
                            .addComponent(countyField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(stateLabel)
                            .addComponent(taxIDLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(taxIDField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ownerLabel)
                            .addComponent(ownerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(townshipLabel)
                    .addComponent(townshipField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(subdivisionLabel)
                    .addComponent(subdivisionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(roofLabel)
                    .addComponent(roofField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(foundationLabel)
                    .addComponent(foundationField, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(levelsLabel)
                    .addComponent(levelsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(typeLabel)
                    .addComponent(petDepositAmountField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(petDepositAmountLabel)
                    .addComponent(petRestrictionsLabel)
                    .addComponent(petRestrictionsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(petsAllowedField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(petsAllowedLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(showingInstructionsField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(showingInstructionsLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(schoolDistrictField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(schoolDistrictLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(marketingRemarksLabel)
                    .addComponent(marketingRemarksField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(agentRemarksLabel)
                    .addComponent(agentRemarksField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(directionsLabel)
                    .addComponent(directionsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(specialFinancingField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(financingRemarksLabel)
                    .addComponent(financingRemarksField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(specialFinancingLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jbPicture1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(picture1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jbPicture3, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(picture3Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jbPicture2, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(picture2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbPicture4, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbPicture5, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbPicture6, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(picture4Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(picture5Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(picture6Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
    }// </editor-fold>//GEN-END:initComponents
protected void setUnit(Unit unit) {
        property.setUnit(unitSelected, unit);
    }

    protected void setRooms(Room[] roomList) {
        property.getUnit(unitSelected).setRoomList(roomList);
    }
    private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
        savePropertyData();
        dao.saveProperty(property);
    }//GEN-LAST:event_saveButtonActionPerformed

    private void jbPicture1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture1ActionPerformed
        fcPic1.showOpenDialog(this);
        picture1Panel.setLayout(new BorderLayout());
        picture1Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic1.getSelectedFile().toString().replace('\\', '/'));
        picture1Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture1Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture1ActionPerformed

    private void jbPicture2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture2ActionPerformed
        fcPic2.showOpenDialog(this);
        picture2Panel.setLayout(new BorderLayout());
        picture2Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic2.getSelectedFile().toString().replace('\\', '/'));
        picture2Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture2Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture2ActionPerformed

    private void jbPicture3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture3ActionPerformed
                fcPic3.showOpenDialog(this);
        picture3Panel.setLayout(new BorderLayout());
        picture3Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic3.getSelectedFile().toString().replace('\\', '/'));
        picture3Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture3Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture3ActionPerformed

    private void jbPicture4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture4ActionPerformed
        fcPic4.showOpenDialog(this);
        picture4Panel.setLayout(new BorderLayout());
        picture4Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic4.getSelectedFile().toString().replace('\\', '/'));
        picture4Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture4Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture4ActionPerformed

    private void jbPicture5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture5ActionPerformed
        fcPic5.showOpenDialog(this);
        picture5Panel.setLayout(new BorderLayout());
        picture5Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic5.getSelectedFile().toString().replace('\\', '/'));
        picture5Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture5Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture5ActionPerformed

    private void jtfNumUnitsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtfNumUnitsFocusLost
        if (!isOldProperty) {
            int numUnits = Integer.parseInt(validateNonNull(jtfNumUnits.getText()));
            if (numUnits > -1) {
                this.property.newUnitArray(numUnits);
                String[] string = new String[numUnits];
                int[] arr = new int[numUnits];
                for (int i = 0; i
                        < numUnits; i++) {
                    string[i] = Integer.toString(i + 1);
                    property.getUnit(i).setUnitid(i + 1);
                }
                jcbUnitNumbers.setModel(new javax.swing.DefaultComboBoxModel(string));
            }
        } else {
        }
        jcbUnitNumbers.validate();


    }//GEN-LAST:event_jtfNumUnitsFocusLost
    private void jcbUnitNumbersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbUnitNumbersActionPerformed
        int i = Integer.parseInt((String) ((JComboBox) evt.getSource()).getSelectedItem());
        this.pdp.setUnit(i, isOldProperty);
    }//GEN-LAST:event_jcbUnitNumbersActionPerformed

    private void jbPicture6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPicture6ActionPerformed
        fcPic6.showOpenDialog(this);
        picture6Panel.setLayout(new BorderLayout());
        picture6Panel.setPreferredSize(new Dimension(339, 166));
        ImageIcon file = new ImageIcon(fcPic6.getSelectedFile().toString().replace('\\', '/'));
        picture6Panel.add(new JLabel(file), BorderLayout.CENTER);
        picture6Panel.setVisible(true);


        this.repaint();


        this.revalidate();
    }//GEN-LAST:event_jbPicture6ActionPerformed

    private void singleFamilyRadioItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_singleFamilyRadioItemStateChanged
        multiFamilyRadio.setEnabled(false);
        jtfNumUnits.setText("1");
        this.jtfNumUnitsFocusLost(null);
        jtfNumUnits.setEnabled(false);
        jcbUnitNumbers.setSelectedIndex(0);
        jcbUnitNumbers.setEnabled(false);
    }//GEN-LAST:event_singleFamilyRadioItemStateChanged
    private void multiFamilyRadioItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_multiFamilyRadioItemStateChanged
       singleFamilyRadio.setEnabled(false);
    }//GEN-LAST:event_multiFamilyRadioItemStateChanged
//Iterator itr = stringList.iterator();while(itr.hasNext()){
    //System.out.println(itr.next());
    //}
    //
    //
    //ListIterator listItr = stringList.listIterator();
    //while(listItr.hasNext()){
    //System.out.println(itr.next());
    //}

    protected int getUnitSelected() {
        System.out.println("jcb:"+jcbUnitNumbers.getSelectedIndex());
        return this.jcbUnitNumbers.getSelectedIndex();     
    }

    public Property getProperty() {
        savePropertyData();


        return this.property;


    }

    private void jRadioButton2StateChanged(javax.swing.event.ChangeEvent evt) {
        singleFamilyRadio.setEnabled(false);
        jtfNumUnits.setEnabled(true);


    }
    private JFileChooser fcPic1 = new JFileChooser();
    private JFileChooser fcPic2 = new JFileChooser();
    private JFileChooser fcPic3 = new JFileChooser();
    private JFileChooser fcPic4 = new JFileChooser();
    private JFileChooser fcPic5 = new JFileChooser();
    private JFileChooser fcPic6 = new JFileChooser();
    private Image returnPic1;
    private Image returnPic2;
    private Image returnPic3;
    private Image returnPic4;
    private Image returnPic5;
    private Image returnPic6;
    private int unitSelected;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField agentRemarksField;
    private javax.swing.JLabel agentRemarksLabel;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JTextField cityField;
    private javax.swing.JLabel cityLabel;
    private javax.swing.JTextField countyField;
    private javax.swing.JLabel countyLabel;
    private javax.swing.JTextField crossStreetField;
    private javax.swing.JLabel crossStreetLabel;
    private javax.swing.JButton deleteButton;
    private javax.swing.JTextField directionsField;
    private javax.swing.JLabel directionsLabel;
    private javax.swing.JTextField financingRemarksField;
    private javax.swing.JLabel financingRemarksLabel;
    private javax.swing.JTextField foundationField;
    private javax.swing.JLabel foundationLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton jbPicture1;
    private javax.swing.JButton jbPicture2;
    private javax.swing.JButton jbPicture3;
    private javax.swing.JButton jbPicture4;
    private javax.swing.JButton jbPicture5;
    private javax.swing.JButton jbPicture6;
    private javax.swing.JComboBox jcbUnitNumbers;
    private javax.swing.JTextField jtfNumUnits;
    private javax.swing.JTextField levelsField;
    private javax.swing.JLabel levelsLabel;
    private javax.swing.JTextField marketingRemarksField;
    private javax.swing.JLabel marketingRemarksLabel;
    private javax.swing.JRadioButton multiFamilyRadio;
    private javax.swing.JButton newButton;
    private javax.swing.JTextField ownerField;
    private javax.swing.JLabel ownerLabel;
    private javax.swing.JTextField petDepositAmountField;
    private javax.swing.JLabel petDepositAmountLabel;
    private javax.swing.JTextField petRestrictionsField;
    private javax.swing.JLabel petRestrictionsLabel;
    private javax.swing.JTextField petsAllowedField;
    private javax.swing.JLabel petsAllowedLabel;
    private javax.swing.JPanel picture1Panel;
    private javax.swing.JPanel picture2Panel;
    private javax.swing.JPanel picture3Panel;
    private javax.swing.JPanel picture4Panel;
    private javax.swing.JPanel picture5Panel;
    private javax.swing.JPanel picture6Panel;
    private javax.swing.JTextField roofField;
    private javax.swing.JLabel roofLabel;
    private javax.swing.JButton saveButton;
    private javax.swing.JTextField schoolDistrictField;
    private javax.swing.JLabel schoolDistrictLabel;
    private javax.swing.JTextField showingInstructionsField;
    private javax.swing.JLabel showingInstructionsLabel;
    private javax.swing.JRadioButton singleFamilyRadio;
    private javax.swing.JTextField specialFinancingField;
    private javax.swing.JLabel specialFinancingLabel;
    private javax.swing.JTextField stateField;
    private javax.swing.JLabel stateLabel;
    private javax.swing.JTextField streetDirField;
    private javax.swing.JLabel streetDirLabel;
    private javax.swing.JTextField streetNameField;
    private javax.swing.JLabel streetNameLabel;
    private javax.swing.JTextField streetNumberField;
    private javax.swing.JLabel streetNumberLabel;
    private javax.swing.JTextField streetSuffixField;
    private javax.swing.JLabel streetSuffixLabel;
    private javax.swing.JTextField subdivisionField;
    private javax.swing.JLabel subdivisionLabel;
    private javax.swing.JTextField taxIDField;
    private javax.swing.JLabel taxIDLabel;
    private javax.swing.JTextField townshipField;
    private javax.swing.JLabel townshipLabel;
    private javax.swing.JTextField typeField;
    private javax.swing.JLabel typeLabel;
    private javax.swing.JTextField zipCodeField;
    private javax.swing.JLabel zipCodeLabel;
    // End of variables declaration//GEN-END:variables
    private DAO dao;
    private Property property;
    private PropertyDetailPanel pdp;
    private Room[] roomList;
}
